package com.weipai.springboot.module.dao.impl;

import com.weipai.springboot.module.dao.EvaluateDao;
import com.weipai.springboot.module.mapper.CustomerEvaluateMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @Author: 曹朋飞
 * @Date: 2018/08/28 19:39
 */
@Repository
public class EvaluateDaoImpl implements EvaluateDao{

    @Autowired
    CustomerEvaluateMapper customerEvaluateMapper;
    
    //分页查询
    @Override
    public List<Map<String, Object>> selectAllByPage(Integer start, Integer size) {
        return customerEvaluateMapper.selectAllByPage(start,size);
    }

    //评论总数量
    @Override
    public Integer selectAllByPageAmount() {
        return customerEvaluateMapper.selectAllByPageAmount();
    }

    //审核
    @Override
    public int evaluateAudit(Integer id, Integer status) {
        return customerEvaluateMapper.evaluateAudit(id, status);
    }

    //回复评论
    @Override
    public int replyEvaluate(Integer id, String replyText) {
        return customerEvaluateMapper.replyEvaluate(id, replyText);
    }

    //获取评论内容
    @Override
    public Map<String, Object> getEvaluateInfo(Integer id) {
        return customerEvaluateMapper.getEvaluateInfo(id);
    }

    //删除
    @Override
    public int batchDeleteById(String[] id) {
        return customerEvaluateMapper.batchDeleteById(id);
    }

    //查询出此货品的一条5星好评
    @Override
    public Map<String, Object> getOneFiveStartEvaluateBySpuNumber(String spuNumber) {
        return customerEvaluateMapper.getOneFiveStartEvaluateBySpuNumber(spuNumber);
    }

    //查出此货品的5星评论总个数
    @Override
    public Integer getFiveStartEvaluateAmountBySpuNumber(String spuNumber) {
        return customerEvaluateMapper.getFiveStartEvaluateAmountBySpuNumber(spuNumber);
    }

    //查出此货品的5星评论总个数
    @Override
    public Integer getEvaluateAmountBySpuNumber(String spuNumber) {
        return customerEvaluateMapper.getEvaluateAmountBySpuNumber(spuNumber);
    }

    //前端调用，某一货品的所有评论，分页查询
    @Override
    public List<Map<String, Object>> getEvaluateBySpuNumber(Integer start, Integer size, String spuNumber, Integer judgeValue) {
        return customerEvaluateMapper.getEvaluateBySpuNumber(start, size, spuNumber, judgeValue);
    }
}
